package com.sk.skplanet.commute.controllers;

import android.content.Context;
import android.graphics.Color;
import android.view.ViewGroup.MarginLayoutParams;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.TextView;

import com.sk.skplanet.commute.actions.Actions;
import com.sk.skplanet.commute.vo.Data;
import com.sk.skplanet.commute.vo.StopInfoVo;

public class StopInfoController {
	public static LinearLayout makeInfo(Context context, StopInfoVo infoVo) {
		LinearLayout layout_info = new LinearLayout(context);
		layout_info.setOrientation(LinearLayout.HORIZONTAL);
		LayoutParams layoutParams_layout_info = new LinearLayout.LayoutParams(
				LayoutParams.MATCH_PARENT, Actions.DPFromPixel(100));
		layoutParams_layout_info.setMargins(0, Actions.DPFromPixel(5), 0,
				Actions.DPFromPixel(5));
		layout_info.setLayoutParams(layoutParams_layout_info);

		layout_info.setPadding(Actions.DPFromPixel(20),
				Actions.DPFromPixel(10), Actions.DPFromPixel(20),
				Actions.DPFromPixel(10));
		layout_info.setBackgroundColor(Color.parseColor(Data.layout_infoColor));

		{// 인포 - busNum 텍스트뷰 설정 부분
			TextView textview_busNum = new TextView(context);
			textview_busNum.setText(infoVo.getBusNum());
			textview_busNum.setTextColor(Color.parseColor(Data.textview_busNumColor));
			textview_busNum.setTextSize((float) Actions.DPFromPixel(15));

			android.view.ViewGroup.LayoutParams layoutParams_textview_busNum = new LayoutParams(
					LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
			((MarginLayoutParams) layoutParams_textview_busNum).setMargins(0,
					0, Actions.DPFromPixel(40), 0);

			textview_busNum.setLayoutParams(layoutParams_textview_busNum);
			layout_info.addView(textview_busNum);

		}

		{// 인포 - busStop 텍스트뷰 설정 부분
			TextView textview_busStopStr = new TextView(context);
			textview_busStopStr.setText("정류장 : ");
			textview_busStopStr.setTextColor(Color.parseColor(Data.textview_routeColor));
			textview_busStopStr.setTextSize((float) Actions.DPFromPixel(12));

			android.view.ViewGroup.LayoutParams layoutParams_textview_busStopStr = new LayoutParams(
					LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
			((MarginLayoutParams) layoutParams_textview_busStopStr).setMargins(
					0, 0, Actions.DPFromPixel(10), 0);

			textview_busStopStr
					.setLayoutParams(layoutParams_textview_busStopStr);
			layout_info.addView(textview_busStopStr);

			TextView textview_busStop = new TextView(context);
			textview_busStop.setText(infoVo.getBusStop());
			textview_busStop.setTextColor(Color.parseColor(Data.textview_routeColor));
			textview_busStop.setTextSize((float) Actions.DPFromPixel(12));

			android.view.ViewGroup.LayoutParams layoutParams_textview_busStop = new LayoutParams(
					LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
			((MarginLayoutParams) layoutParams_textview_busStop).setMargins(0,
					0, Actions.DPFromPixel(40), 0);
			textview_busStop.setLayoutParams(layoutParams_textview_busStop);
			layout_info.addView(textview_busStop);
		}

		{// 인포 - 도착 예정 시간 텍스트뷰 설정 부분
			TextView textview_arriveTime = new TextView(context);
			textview_arriveTime.setText("도착예정시간");
			textview_arriveTime.setTextColor(Color.parseColor(Data.textview_arriveTimeColor));
			textview_arriveTime.setTextSize((float) Actions.DPFromPixel(12));

			android.view.ViewGroup.LayoutParams layoutParams_textview_busNum = new LayoutParams(
					LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);

			textview_arriveTime.setLayoutParams(layoutParams_textview_busNum);
			layout_info.addView(textview_arriveTime);

		}

		return layout_info;
	}
}
